-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ruff config #15516
Improve ruff config #15516
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to have fix on by default, can we mark the following as unfixable:
unfixable = [
"F841", # unused variable. ruff keeps the call, but mostly we want to get rid of it all
"F601", # automatic fix might obscure issue
"F602", # automatic fix might obscure issue
"B018", # automatic fix might obscure issue
]
This comment has been minimized.
This comment has been minimized.
So I gather they "autofix" B018 ("Found useless expression. Either assign it to a variable or remove it.") by ... removing the expression rather than assigning it? Update: https://beta.ruff.rs/docs/rules/#flake8-bugbear-b doesn't suggest B018 has a fixer currently. Are you adding it just as a precaution? |
I just went with Shantanu's suggestions here, but I definitely agree that it's good in general to be cautious with autofixes, and I agree that if they were to add an autofix for B018, we probably wouldn't want it |
Oh hmmm I don't remember why I marked B018 unfixable, possibly just defensive, possibly I just looked at some undesirable change and got confused about what "fixed" it. I added ruff to my work codebase a couple weeks ago and my suggestion^ is just whatever I'd decided was good at that time. In case you're curious, this is what I have currently at work:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
fix = true
topyproject.toml
. This means ruff will apply autofixes when possible ifruff .
is run (and will apply autofixes to PRs).CONTRIBUTING.md
about how you'll get a CI failure if you don't run black and isort before filing a PR. This is no longer true since we switched to using pre-commit.ci.